package org.yjc.custom;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.yjc.entity.Journal;
import org.yjc.entity.SysUser;
import org.yjc.service.JournalService;
@Component
public class JournalUtils {
	@Autowired
	private UserUtils userutils;
	@Autowired
	private JournalService journalservice;
	
	public void journal1(String handle,String details) {
		SysUser user = userutils.getUser();	 //获取当前用户
		Journal journal = new Journal();
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
		journal.setHandlename(user.getName()); //存入姓名
		journal.setHandletime(df.format(new Date())); //存入操作时间
		journal.setHandleuser(user.getUsername()); //用户名
		journal.setHandle(handle);
		journal.setDetails(details);
		journalservice.save(journal);
	}
}
